from django.contrib.auth.models import AbstractUser
from django.db import models
from basemodel import BaseBean


# Create your models here.
class UserBean(AbstractUser, BaseBean):
    # 头像
    header = models.ImageField(upload_to="header", default="header/logo1.png", verbose_name="头像")
    # 性别：默认为0(男)
    gender = models.BooleanField(default=1, verbose_name="性别")
    tags = models.CharField(max_length=96, default="系统原装签名，送给每一位小可爱~", verbose_name="签名")
    phone = models.CharField(max_length=11, null=True, blank=True, verbose_name="电话")

    class Meta:
        # 确定表名
        db_table = "table_user"
        # 中文名称
        verbose_name = "用户名"
        # 模型的复数形式(即自动在模型后添加一个s)
        verbose_name_plural = verbose_name


class UserRelations(BaseBean):
    user_id = models.ForeignKey("UserBean", verbose_name="用户", on_delete=models.CASCADE)
    fans_id = models.ForeignKey("UserBean", verbose_name="粉丝", on_delete=models.CASCADE)

    class Meta:
        # 确定表名
        db_table = "table_relations"
        # 中文名称
        verbose_name = "用户关系"
        # 模型的复数形式(即自动在模型后添加一个s)
        verbose_name_plural = verbose_name
